package zhai.git;

import java.util.concurrent.locks.ReentrantLock;

public class TReentrantLock {

    ReentrantLock lock = new ReentrantLock();

    public static void main(String[] args) {
        TReentrantLock t = new TReentrantLock();
        new Thread(() -> {
            t.send();
        }).start();
    }


    public void send() {
        lock.lock();
        try {
            System.out.println("send");
            call();
        } finally {
            lock.unlock();
        }
    }

    public void call() {
        lock.lock();
        try {
            System.out.println("call");
        } finally {
            lock.unlock();
        }
    }
}
